﻿//     Copyright (c) Microsoft Corporation.  All rights reserved.

using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Web;

namespace Gateway.Console.Models
{
    public class AnalyticsReportModel
    {
        [Key]
        public int Id { get; set; }

        public string Report { get; set; }

        public string Description { get; set; }

        public bool HasMultipleSeries { get; set; }

        public string TickInterval { get; set; }

        public string TickFormat { get; set; }

        public string HiveTable { get; set; }

        [NotMapped]
        public string HiveTempTable
        {
            get { return this.HiveTable + "_tmp"; }
        }

        public string SeriesColumn { get; set; }

        public string FilterPredicate { get; set; }

        public string DistinctExpression { get; set; }

        public DateTime? LastDate { get; set; }

        public virtual ICollection<AnalyticsReportRow> Rows { get; set; }
    }

    public class AnalyticsReportRow
    {
        [Key]
        public int Id { get; set; }

        public DateTime Date { get; set; }

        public double Value { get; set; }

        public string Series { get; set; }
    }
}